package com.hps.demo.filter;

import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;

/**
 * @author heps
 * @date 2019/1/23 14:46
 */
public class FilterProducer {

    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("group1");
        producer.setNamesrvAddr("192.168.26.137:9876");
        producer.start();

        for (int i = 0; i < 100; i++) {
            Message msg = new Message("TestTopic",
                    "Hello Filter Msg".getBytes());
            msg.putUserProperty("a", String.valueOf(i));
            SendResult sendResult = producer.send(msg);
            System.out.println(sendResult);
        }
    }
}
